-
Notifications
You must be signed in to change notification settings - Fork 551
Don't lose known offset-types in array_replace() #4826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| assertType("non-empty-array<'bar'|'foo'|int, string>", array_replace($array1, $array3)); | ||
| assertType("non-empty-array<'bar'|'foo'|int, string>", array_replace($array3, $array1)); | ||
| assertType("non-empty-array<'bar'|'foo'|int, string>&hasOffset('bar')&hasOffset('foo')", array_replace($array1, $array3)); | ||
| assertType("non-empty-array<'bar'|'foo'|int, string>&hasOffsetValue('bar', '2')&hasOffsetValue('foo', '1')", array_replace($array3, $array1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this kind of overlaps. should we do something about it, or is it fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the non-empty-array and the hasOffset(Value) ?
I think it's more clear this way, by being explicit.
I dunno if it's currently possible to get a dump
array<...>&hasOffset(..)
It would be weird to be able to get both array or non-empty-array in this situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the type is
non-empty-array<'bar'|'foo'|int, string>&hasOffsetValue('bar', '2')&hasOffsetValue('foo', '1')
while some keys in
non-empty-array<'bar'|'foo'|int, string>
are redundant with the accessories in
hasOffsetValue('bar', '2')&hasOffsetValue('foo', '1')
|
@claudepache @VincentLanglet you might be interessted in reviewing this one |
|
Thank you! |
analog #4554